package com.acwing.chapter3;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author anan
 * @create 2021-07-27 22:27
 */
public class Zixulie {
    public static void main(String[] args) throws IOException {
        int N = 100010;
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] str1 = reader.readLine().split(" ");
        int n = Integer.parseInt(str1[0]);
        int m = Integer.parseInt(str1[1]);

        int[] a = new int[N];
        int[] b = new int[N];

        String[] str2 = reader.readLine().split(" ");
        String[] str3 = reader.readLine().split(" ");

        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(str2[i]);
        }
        for (int i = 0; i < m; i++) {
            b[i] = Integer.parseInt(str3[i]);
        }

        if (n <= m){
            int res = 0;
            for (int i = 0, j = 0; i < n; i++) {
                while (b[j] != a[i] && j < m) j++;
                if (b[j] == a[i]) {
                    j++;
                    res++;
                }
            }
            if (res == n){
                System.out.println("Yes");
            }
            else System.out.println("No");
        }
    }
}
